<?php

class Recruiter_AccountController extends Zend_Controller_Action
{
	private $userId;
	public function init()
	{
		$authData = Zend_Auth::getInstance ()->getStorage ()->read ();
		Zend_Registry::get('logger')->debug($authData);
		if (is_array($authData) and $authData['identity'] != 'anon' and $authData) {
			$this->userId = $authData['userId'];
		}
		unset($authData);	
	}
	public function viewAction()
	{
		$user = new RP_Model_User_Base();
		$user->setUser_id($this->userId);
		if($user->populateUser()){
			$this->view->assign('user_id',$user->getUser_id());
			$this->view->assign('username',$user->getUsername());
			$this->view->assign('email',$user->getEmail());
			$this->view->assign('user_type_id',$user->getUser_type_id());
			$this->view->assign('valid_from',$user->getValid_from());
		}
		else{
			throw new Zend_Exception('Not a valid recruiter user with $user_id:'.$user->getUser_id());
		}
	}
}